package com.dc.constant;

import org.apache.commons.collections4.set.UnmodifiableSet;

import java.util.*;

public class Constants {

    // 完成
    public static final Integer COMPLATE_YES = 1;
    // 未完成
    public static final Integer COMPLETE_NO = 0;

    public static final String TAG_TOKEN = "Authorization";

    public static final List<String> URL_WHITE_LIST = Arrays.asList("/api/account/login", "/api/account/register","/api/excel/import/energy","/api/excel/import/standard","/api/excel/import/material");

    public static final String DEFAULT_RESOURCE_PREFIX = "/profile";
    public static final String DEFAULT_RESOURCE_PREFIX_PATH = "/api/profile";

    public static final String DEFAULT_ROLE = "user";

    public static final Map<String, String> shipTypeMap ;

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    // 开始时间
    public static final String DEFAULT_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";

    //////   http
    // 4日，2小时，5月，16季度，15年周（一年52周），6年
    /** 小时 */
    public static final Integer DATE_TYPE_HOUR = 2;

    public static final Integer FLAG_WRITE_MONTH = 1;     // 写http数据
    public static final Integer FLAG_SYNC_MONTH = 0;      // 同步http数据

    public static final String NAME_C_MONITOR_EXCLUDE = "总产值";      // 碳排放数据  动态计算内部监控碳排放需要排除的 实物量 的行
    public static final String NAME_C_SHENZHEN_INCLUDE = "碳排放量-因子指标";       // 碳排放量-深圳指南
    public static final String NAME_C_FLAG_INCLUDE = "碳排放量月度/年度指标";     // 参数
    public static final String NAME_C_POWER_INCLUDE = "碳排放强度-因子指标";     // 碳排放强度-深圳指南
    public static final String NAME_C_POWER_FLAG_INCLUDE = "碳排放强度月度/年度指标";   // 参数

    public static final String NAME_C_POWER_FLAG_INCLUDE_KEY = "name_c_power_flag_include";
    public static final String NAME_C_CHECK_QUOTA_SHENZHEN_ZHAO = "招商重工-深圳市碳配额";
    public static final String NAME_C_CHECK_QUOTA_SHENZHEN_YOU = "友联船厂-深圳市碳配额";
    public static final String NAME_C_CHECK_QUOTA_SHENZHEN_ZI = "孖洲岛-深圳市碳配额";

    public static final String NAME_COMPANY_YOU = "友联船厂";
    public static final String NAME_COMPANY_ZHAO = "招商重工";
    public static final String NAME_COMPANY_ZIZHOU = "孖洲岛";

    public static final Integer TYPE_DC_IN_MONITOR = 1;  // 内部监控  1
    public static final Integer TYPE_DC_C_CHECK = 2;    // 碳核查  2

    public static String KEY_C_COMPLETE_RATE = "c_complete_rate";       // 碳排放指标完成率

    // 机电管子类型
    public static final String TYPE_MACHINE_PIPE_FALAN = "法兰";
    public static final String TYPE_MACHINE_PIPE_WANTOU = "弯头";

    public static final String METHOD_MACHINE_PIPE_CO2 = "CO2";
    public static final String METHOD_MACHINE_PIPE_YAHU = "氩弧";

    // 船体焊接方式
    public static final String WELD_TYPE_SHIP = "船体焊接";
    public static final String WELD_TYPE_IN = "内场焊接";

    // 特殊四条船名称
    public static final String SHIP_NAME_YASHAN = "亚善";
    public static final String SHIP_NAME_KANGDI = "康帝";
    public static final String SHIP_NAME_YUYOU = "宇右精神";
    public static final String SHIP_NAME_KAIYUE = "凯粤";

    public static final Long SHIP_ID_YASHAN = 10000001L;
    public static final Long SHIP_ID_KANGDI = 10000002L;
    public static final Long SHIP_ID_YUYOU = 10000003L;
    public static final Long SHIP_ID_KAIYUE = 10000004L;

    // 工序名称
    public static final String WORK_FLOW_SHIP_CUT = "船体下料";         // 船体下料
    public static final String WORK_FLOW_SHIP_OLD = "船体割旧";         // 船体割旧
    public static final String WORK_FLOW_SHIP_WELD = "船体焊接";        // 船体焊接
    public static final String WORK_FLOW_MACHINE_PIPE = "机电焊接";     // 机电焊接
    public static final String WORK_FLOW_TOW_SHIP_OIL = "拖轮油耗";     // 拖轮油耗
    public static final String WORK_FLOW_OTHER_OIL_SHIP = "单船";      // 其他油耗-单船
    public static final String WORK_FLOW_OTHER_OIL_CAR = "高空车";     // 其他油耗-高空车
    public static final String WORK_FLOW_PAINT_SHIP = "舱室及船壳喷漆";  // 涂装喷漆-舱室及船壳喷漆
    public static final String WORK_FLOW_PAINT_HOUSE = "喷漆房分段喷漆";  // 涂装喷漆-喷漆房分段喷漆
    public static final String WORK_FLOW_SHIP_SAND = "舱室打砂";         // 打砂除锈-舱室打砂
    public static final String WORK_FLOW_HOUSE_SAND = "打砂房分段打砂";    // 打砂除锈-打砂房分段打砂
//    public static final String WORK_FLOW_WATER_CLEAN_WATER = "清洁/冲水"; // 清洁/冲水
//    public static final String WORK_FLOW_WATER_CLEAN_RUST = "超水除锈";   // 超水除锈
    public static final String WORK_FLOW_WATER_CLEAN = "超水除锈";   // 超水除锈
    public static final String WORK_FLOW_ELECTRIC_BOX = "移动电箱";       // 移动电箱

    // 特殊的车间
    public static final String WORK_FLOW_ROOM_AIR = "气站";

    // 维修单状态
    public static final Integer SHIP_REPAIR_STAT_COMPLETE = 1;
    public static final Integer SHIP_REPAIR_STAT_NOT_COMPLETE = 0;

    // 深圳 碳排放  0   海洋碳排放 1
    public static final Integer TYPE_C_SHENZHEN = 0;
    public static final Integer TYPE_C_OCEAN = 1;

    private static final Set<Long> SHIP_REPAIR_ID_SPECIAL = new HashSet<>();

    // 单船 能源
//    public static final String ENERGY_CATEGORY_POWER = "电力";
//    public static final String ENERGY_CATEGORY_OIL = "柴油";
//    public static final String ENERGY_CATEGORY_GAS = "液化天然气";
//    public static final String ENERGY_CATEGORY_CO2 = "二氧化碳";





    // 能源
    // 电力
    // 液化天然气
    // 二氧化碳
    //柴油
    //汽油
    //碳排放量月度/年度指标
    //碳排放强度月度/年度指标
    //外购电力
    //柴油(生产、自有船舶、车辆)
    //通勤车辆柴油
    //通勤车辆汽油
    //液态二氧化碳
    //招商重工-深圳市碳配额
    //友联船厂-深圳市碳配额
    //瓶装乙炔

    // 孖洲岛-深圳市碳配额
    //电力-船舶及海洋工程装备
    //液化天然气-船舶及海洋工程装备
    //二氧化碳-船舶及海洋工程装备
    public static final String ENERGY_TYPE_SHENZHEN_ELECTRIC = "电力";
    public static final String ENERGY_TYPE_SHENZHEN_GAS      = "液化天然气";
    public static final String ENERGY_TYPE_SHENZHEN_CO2      = "二氧化碳";
    public static final String ENERGY_TYPE_SHENZHEN_GASONLINE = "汽油";
    public static final String ENERGY_TYPE_SHENZHEN_OIL = "柴油";

    public static final String ENERGY_TYPE_OCEAN_ELECTRIC    = "电力-船舶及海洋工程装备";
    public static final String ENERGY_TYPE_OCEAN_GAS         = "液化天然气-船舶及海洋工程装备";
    public static final String ENERGY_TYPE_OCEAN_CO2         = "二氧化碳-船舶及海洋工程装备";

    public static final String ENERGY_TYPE_OCEAN_OIL = "柴油-船舶及海洋工程装备";

    // 工序碳标定  转换参数
    public static final Double PARAM_CALIBRATION_TRANSFORMER_1 = 1.4;
    //
    public static final Double PARAM_CALIBRATION_TRANSFORMER_2 = 0.506;
    //
    public static final int PARAM_CALIBRATION_TRANSFORMER_3 = 10;

    // 预警  一般和严重的阀值  0.25
    public static final Double ALARM_THRESHOLD = 0.25;


    public static boolean containsSpecialShipRepairId(Long repairId) {
        return SHIP_REPAIR_ID_SPECIAL.contains(repairId);
    }

    // 船厂碳排放 ratio
    private static final Map<String, Double> ratioMap = new HashMap();

    public static Double getRatioByEnergyType(String energyType) {
        return ratioMap.get(energyType);
    }

    static {

        // 特殊的维修单id
        SHIP_REPAIR_ID_SPECIAL.add(SHIP_ID_YASHAN);
        SHIP_REPAIR_ID_SPECIAL.add(SHIP_ID_KANGDI);
        SHIP_REPAIR_ID_SPECIAL.add(SHIP_ID_YUYOU);
        SHIP_REPAIR_ID_SPECIAL.add(SHIP_ID_KAIYUE);

        // 船类型 22 个
        shipTypeMap = new HashMap<>();
        shipTypeMap.put("专用船", "专用船");
        shipTypeMap.put("其他", "其他");
        shipTypeMap.put("其他类型干货船", "其他类型干货船");
        shipTypeMap.put("其他类型液货船", "其他类型液货船");
        shipTypeMap.put("客船", "客船");
        shipTypeMap.put("工程及服务船", "工程及服务船");
        shipTypeMap.put("干散液散兼用船", "干散液散兼用船");
        shipTypeMap.put("拖带船", "拖带船");
        shipTypeMap.put("拖轮", "拖轮");
        shipTypeMap.put("散货船", "散货船");
        shipTypeMap.put("未知类型干货船", "未知类型干货船");
        shipTypeMap.put("未知类型液货船", "未知类型液货船");
        shipTypeMap.put("未知类型船舶", "未知类型船舶");
        shipTypeMap.put("杂货船", "杂货船");
        shipTypeMap.put("气槽船", "气槽船");
        shipTypeMap.put("油船", "油船");
        shipTypeMap.put("渔船", "渔船");
        shipTypeMap.put("游艇", "游艇");
        shipTypeMap.put("滚装船", "滚装船");
        shipTypeMap.put("石油化学品船", "石油化学品船");
        shipTypeMap.put("近海作业船", "近海作业船");
        shipTypeMap.put("集装箱船", "集装箱船");

        // ratio 常量 13项目
        ratioMap.put("电力", 1.);
        ratioMap.put("柴油", 0.00085);
        ratioMap.put("汽油", 0.0007199999999999999);
        ratioMap.put("液化天然气", 1.);
        ratioMap.put("二氧化碳", 1.);
        ratioMap.put("外购电力", 1.);
        ratioMap.put("柴油(生产、自有船舶、车辆)", 0.0008449999999999999);
        ratioMap.put("通勤车辆柴油", 0.0008449999999999999);
        ratioMap.put("通勤车辆汽油", 0.000775);
        ratioMap.put("液态二氧化碳", 1.);
        ratioMap.put("瓶装二氧化碳", 0.007);
        ratioMap.put("瓶装乙炔(5kg)", 0.005);
        ratioMap.put("瓶装乙炔(40L)", 0.00017094017094017094);

    }
}
